﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Generation.aspx.cs" Inherits="ZLCMS.Web.SystemManage.Basics.GenerationLink.Generation"
    ValidateRequest="False" %>

<%@ Register TagPrefix="fc" TagName="JFileControl" Src="~/SystemManage/Control/JFileControl.ascx " %>

<form id="pageForm" method="post" runat="Server" class="pageForm required-validate"
onsubmit="return validateCallback(this, navTabAjaxDone);" action="/SystemManage/Basics/GenerationLink/Generation.aspx">
<asp:hiddenfield runat="server" id="hid_kind"></asp:hiddenfield>
<!-- 需保存的全局变量 -->
<asp:label runat="server" id="_id" visible="False"></asp:label>
<input runat="Server" ID="position_Code" type="hidden" />
<div class="pageContent">
    <div class="pageFormContent" layouth="56">
        <dl class="nowrap">
            <dt>页面类型：</dt>
            <dd>
             <asp:dropdownlist runat="server" id="ddl_page_type"></asp:dropdownlist>
            </dd>
        </dl>
        <dl class="nowrap">
            <dt id="p1" name="dt_p1" style="display:none;">&nbsp;</dt>
            <dd>
                <asp:textbox runat="server" id="txt_p1" style="display:none;" name="input_p" class="" width="50%" ></asp:textbox>
            </dd>
        </dl>
        <dl class="nowrap">
            <dt id="p2" name="dt_p2" style="display:none;">&nbsp;</dt>
            <dd>
              <asp:textbox runat="server" id="txt_p2" style="display:none;" name="input_p" class="" width="50%" ></asp:textbox>
            </dd>
            </dl>
          <dl class="nowrap">
            <dt id="p3" name="dt_p3" style="display:none;">&nbsp;</dt>
            <dd>
              <asp:textbox runat="server" style="display:none;"  id="txt_p3" name="input_p"  class="" width="50%" ></asp:textbox>
            </dd>
            </dl>
              <dl class="nowrap">
            <dt id="pt4" name="dt_p4" style="display:none;">&nbsp;</dt>
            <dd>
              <asp:textbox runat="server"  style="display:none;" id="txt_p4" name="input_p" class="" width="50%" ></asp:textbox>
            </dd>
            </dl>
              <dl class="nowrap">
            <dt id="pt5" name="dt_p5" style="display:none;">&nbsp;</dt>
            <dd>
              <asp:textbox runat="server" style="display:none;"  id="txt_p5" name="input_p"  class="" width="50%" ></asp:textbox>
            </dd>
            </dl>
             <dl class="nowrap">
            <dt><input type="button" onclick="generationUrl()"  value="生成链接" id="input_generation"/></dt>
            <dd>&nbsp;</dd>
            </dl>
            <dl class="nowrap">
            <dt>链接地址：</dt>
            <dd>
              <asp:textbox runat="server"  id="txt_url"  class="" width="100%" ></asp:textbox>
            </dd>
            </dl>
            <dl class="nowrap">
            <dt>温馨提示:</dt>
            <dd>
              <font style="color:red">请直接复制链接到需要配置跳转的地方</font>
            </dd>
            </dl>
    </div>
    <div class="formBar">
        <ul>
           <%-- <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            保存</button></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            取消</button></div>
                </div>
            </li>--%>
        </ul>
    </div>
</div>
<script type="text/javascript">
    var url = "";
    $(function () {
        var el = $("#<%=ddl_page_type.ClientID %>");
        el.change(function () {
            for (var i = 1; i < 6; i++) {
                $("#p" + (i)).html("").hide();
                $("#txt_p" + (i)).removeAttr("param").val("").removeClass("param").hide();
            }
            //获取页面类型参数
            el.ExecuteCommand({
                successCallBack: function (result) {
                  
                    if (result) {
                        url = result.Param1;
                        $("#txt_url").val(url);
                        var paramlist = eval(result.Param2);
                        for (var i = 0; i < paramlist.length; i++) {
                            $("#p" + (i + 1)).html(paramlist[i].name + "：").show();
                            $("#txt_p" + (i + 1)).attr("param", paramlist[i].code).show();
                        }
                    }
                },
                errorCallback: function (errorCode, msg) {
                    showTips(msg);
                }
            }, 'LoadPageType', { Code: el.val() });
        });
    });
    function generationUrl() {
        var inputList = $("input[param]");
        var generatUrl = url;
        for (var i = 0; i < inputList.length; i++) {
            if (i == 0) {
                generatUrl += "?" + $(inputList[i]).attr("param") + "=" + $(inputList[i]).val();
            } else {
                generatUrl += "&" + $(inputList[i]).attr("param") + "=" + $(inputList[i]).val();
            }
        }
        $("#txt_url").val(generatUrl);
    }
</script>
</form>
